ClusterEval_plot <- function(data, data_type = c('heatmap', 'tSNE', 'UMAP'), cluster_col, ft_cols){
    # Heatmap
    if(data_type == 'heatmap'){
        library(gplots)
        scale_max = max(data)
        heat_palette_med <- colorRampPalette(c("black", "yellow","#FAF7C9"))
        pairs.breaks_med <- c(seq(0, scale_max/6.6, by = 0.1),
                              seq(scale_max/6.6, scale_max/3.3, by = 0.1),
                              seq(scale_max/3.3, scale_max, by = 0.1))

        hm_pl <- heatmap.2(data,
                  main = "Median protein expression",
                  dendrogram = "both",
                  Rowv = TRUE,
                  Colv = TRUE,
                  breaks = pairs.breaks_med,
                  revC = FALSE,
                  symkey = FALSE,
                  symbreaks = FALSE,
                  scale = "none",
                  cexRow = 0.8,
                  cexCol = 0.8,
                  key = TRUE,
                  col = heat_palette_med,
                  trace = "none",
                  density.info = 'none',
                  sepcolor="#424242",
                  margins = c(6,10),
                  colsep=1:ncol(data),
                  rowsep=1:nrow(data),
                  sepwidth=c(0.005,0.005),
                  keysize = 1,
                  key.title = 'Intensity',
                  key.xlab= "Arcsinh Transform",
                  extrafun = box(lty = "solid"),
                  cellnote = data,
                  notecol = 'red',
                  srtCol=45
                  )
        return(hm_pl)
    }

    if(data_type == 'tSNE'){
        # Plotting
        library(ggplot2)
        library(gridExtra)
        library(reshape2)
        data <- data[c(colnames(data)[ft_cols], cluster_col, 'tSNE1', 'tSNE2')]
        test <- melt(data, id= c(cluster_col, 'tSNE1', 'tSNE2'))
        var_list <- unique(test$variable)
        pl <- list()

        # Defining cluster centers
        edata <- cbind(data$tSNE1, data$tSNE2, cluster_col=data[cluster_col])
        colnames(edata) <- c('x', "y", "z")
        center <- aggregate(cbind(x,y) ~ z, data = edata, median)

        p_cl <- ggplot(data, aes_string(x='tSNE1', y='tSNE2', color = data[,cluster_col]))+
          geom_point(alpha=0.6, shape = 19) + theme_bw() + ggtitle(cluster_col)+
          annotate("text", label = center[,1], x=center[,2], y = center[,3],
                   size = 6, colour = "black", fontface = 'bold')
        for(i in seq_along(var_list)) {
          p <- ggplot(subset(test,test$variable==var_list[i]), aes(x=tSNE1, y=tSNE2, colour = value)) +
            geom_point(alpha=0.4) + theme_bw() + ggtitle(var_list[i]) +
            scale_colour_gradient(low = "gray75", high = "blue")
          pl[[i]] <- p
        }

        plot(p_cl)
        tsne_pl <- grid.arrange(grobs=pl)
    }

    if(data_type == 'UMAP'){
        # Plotting
        library(ggplot2)
        library(gridExtra)
        library(reshape2)
        data <- data[c(colnames(data)[ft_cols], cluster_col, 'UMAP1', 'UMAP2')]
        test <- melt(data, id= c(cluster_col, 'UMAP1', 'UMAP2'))
        var_list <- unique(test$variable)
        pl <- list()

        # Defining cluster centers
        edata <- cbind(data$UMAP1, data$UMAP2, cluster_col=data[cluster_col])
        colnames(edata) <- c('x', "y", "z")
        center <- aggregate(cbind(x,y) ~ z, data = edata, median)

        p_cl <- ggplot(data, aes_string(x='UMAP1', y='UMAP2', color = data[,cluster_col]))+
          geom_point(alpha=0.6, shape = 19) + theme_bw() + ggtitle(cluster_col)+
          annotate("text", label = center[,1], x=center[,2], y = center[,3],
                   size = 6, colour = "black", fontface = 'bold')
        for(i in seq_along(var_list)) {
          p <- ggplot(subset(test,test$variable==var_list[i]), aes(x=UMAP1, y=UMAP2, colour = value)) +
            geom_point(alpha=0.4) + theme_bw() + ggtitle(var_list[i]) +
            scale_colour_gradient(low = "gray75", high = "blue")
          pl[[i]] <- p
        }
        
        plot(p_cl)
        umap_pl <- grid.arrange(grobs=pl)
    }
}
annot_df <- annot_df[-which(annot_df$CANARY =='I'),]
ref <- ref[-which(ref$CANARY =='I'),]

# Changing un-identified T cells into "Other_immune"
k <- which(annot_df$subtype =='T_cells')
k2 <- which(annot_df$subtype =='NK_cells')

annot_df['subtype'] <- as.character(annot_df$subtype)
annot_df[c(k,k2), 'subtype'] <- 'Other_immune'
annot_df$subtype <- as.factor(annot_df$subtype)

annot_df['subtype4'] <- as.character(annot_df$subtype)
annot_df[which(annot_df$cell_type=='Epithelial'), 'subtype4'] <- 'Epithelial'
annot_df$subtype4 <- as.factor(annot_df$subtype4)
dendrogram_barplot <- function(data, dist_method = 'euclidean', 
    hclust_method = 'ward.D', corr_mat = FALSE){
    
    # Dendrogram
    if(corr_mat){
        corr_pt <- Hmisc::rcorr(t(as.matrix(data)), type = 'spearman')
        dist_mat <- dist(corr_pt$r, method = dist_method)
    } else {
        dist_mat <- dist(data, method = dist_method)
    }
    hclust_avg <- hclust(dist_mat, method = hclust_method)
    par(mar=c(2,7,4,2), lwd=2, mgp=c(3,1,0), las=1, font.lab=2)
    plot(hclust_avg,cex = 0.8, hang = -1, main = paste0(hclust_method, ' linkage'))
    
    # Barplot
    coul = brewer.pal(9, "Set1")
    data <- data[hclust_avg$order,] #dendrogram order
    data <- t(as.matrix(data))
    
    par(mgp=c(1.5,0.25,0), las=1, mar = c(3, 5, 1, 7.5), xpd=TRUE, font.lab=2, lwd=1) # axis label locations
    barplot(data,
            col=coul ,
            border='white',
            horiz=TRUE,
            cex.names=0.75,
            cex.axis = 0.75)
    title(xlab="Cell type (% of sample)", mgp = c(1.5, 0.5, 0))
    title(ylab="Patient ID",  mgp = c(3, 0.1, 0))
    legend('topright', legend = rownames(data), fill = coul, ncol = 1, inset=c(-0.3,0),
               cex = 0.75)

}

All cells after denoising

Major cell types

Only major cell types

prcnt_by_pt <- ClassAbundanceByPt(data=annot_df, ptID_col = 'pt_ID', 
    class_col = 'cell_type')
rownames(prcnt_by_pt) <- paste0(rownames(prcnt_by_pt), '_', ref$CANARY)

levels(annot_df$cell_type)
## [1] "Endothelial" "Epithelial"  "Immune"      "Mesenchymal"
# Dendrograms and barplots
dendrogram_barplot(prcnt_by_pt, dist_method = 'euclidean', hclust_method = 'ward.D')

dendrogram_barplot(prcnt_by_pt, dist_method = 'euclidean', hclust_method = 'complete')

# Correlation plot
corr_plot(prcnt_by_pt)

ggpubr::ggscatter(prcnt_by_pt, x = "Endothelial", y = 'Immune',
          add = "reg.line", conf.int = TRUE, combine = TRUE,
          cor.coef = TRUE, cor.method = "spearman", add.params = list(color = 'gray'),
          xlab = "Endothelial cells", ylab = 'Immune cells')
## `geom_smooth()` using formula 'y ~ x'

# Differential abundance
x <- DA_analysis(annot_df, ref, class_col='cell_type', group_levels=c('G','P'),
     group_col = 'CANARY', ptID_col = 'pt_ID')
## 
## Attaching package: 'operators'
## The following objects are masked from 'package:base':
## 
##     options, strrep
## 
## Attaching package: 'dplyr'
## The following object is masked from 'package:operators':
## 
##     %>%
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
x$pvals
##     cell_type   p.value FDR_corrected
## 1 Endothelial 0.1714286     0.6349206
## 2  Epithelial 0.9142857     0.9142857
## 3      Immune 0.3523810     0.6349206
## 4 Mesenchymal 0.4761905     0.6349206

Subtypes

All subtypes

##  [1] "Endothelial"   "Epithelial_1"  "Epithelial_10" "Epithelial_2" 
##  [5] "Epithelial_3"  "Epithelial_4"  "Epithelial_5"  "Epithelial_6" 
##  [9] "Epithelial_7"  "Epithelial_8"  "Epithelial_9"  "Mesenchymal"  
## [13] "Myeloid"       "Other_immune"  "Tc_cells"      "Th_cells"

##        cell_type   p.value FDR_corrected
## 1    Endothelial 0.1714286     0.7619048
## 2   Epithelial_1 0.3523810     0.7619048
## 3  Epithelial_10 0.4761905     0.7619048
## 4   Epithelial_2 0.9142857     0.9142857
## 5   Epithelial_3 0.1714286     0.7619048
## 6   Epithelial_4 0.7619048     0.8707483
## 7   Epithelial_5 0.9142857     0.9142857
## 8   Epithelial_6 0.4761905     0.7619048
## 9   Epithelial_7 0.4761905     0.7619048
## 10  Epithelial_8 0.6095238     0.8126984
## 11  Epithelial_9 0.6095238     0.8126984
## 12   Mesenchymal 0.4761905     0.7619048
## 13       Myeloid 0.3523810     0.7619048
## 14  Other_immune 0.7619048     0.8707483
## 15      Tc_cells 0.1714286     0.7619048
## 16      Th_cells 0.3523810     0.7619048
## `geom_smooth()` using formula 'y ~ x'

## `geom_smooth()` using formula 'y ~ x'

Subtypes (Epithelial cells as one group)

## [1] "Endothelial"  "Epithelial"   "Mesenchymal"  "Myeloid"      "Other_immune"
## [6] "Tc_cells"     "Th_cells"

##      cell_type   p.value FDR_corrected
## 1  Endothelial 0.1714286     0.6000000
## 2   Epithelial 0.9142857     0.9142857
## 3  Mesenchymal 0.4761905     0.6666667
## 4      Myeloid 0.3523810     0.6166667
## 5 Other_immune 0.7619048     0.8888889
## 6     Tc_cells 0.1714286     0.6000000
## 7     Th_cells 0.3523810     0.6166667

Only Immune

All subtypes

## [1] "Myeloid"      "Other_immune" "Tc_cells"     "Th_cells"

##      cell_type   p.value FDR_corrected
## 1      Myeloid 1.0000000             1
## 2 Other_immune 0.9142857             1
## 3     Tc_cells 0.4761905             1
## 4     Th_cells 0.6095238             1

Only Epithelial

All Epithelial subtypes

##  [1] "Epithelial_1"  "Epithelial_10" "Epithelial_2"  "Epithelial_3" 
##  [5] "Epithelial_4"  "Epithelial_5"  "Epithelial_6"  "Epithelial_7" 
##  [9] "Epithelial_8"  "Epithelial_9"

##        cell_type   p.value FDR_corrected
## 1   Epithelial_1 0.7619048     0.9142857
## 2  Epithelial_10 0.6095238     0.9142857
## 3   Epithelial_2 0.9142857     0.9142857
## 4   Epithelial_3 0.1714286     0.8571429
## 5   Epithelial_4 0.7619048     0.9142857
## 6   Epithelial_5 0.9142857     0.9142857
## 7   Epithelial_6 0.9142857     0.9142857
## 8   Epithelial_7 0.1714286     0.8571429
## 9   Epithelial_8 0.3523810     0.8809524
## 10  Epithelial_9 0.3523810     0.8809524

Stromal cells only

All subtypes

## [1] "Endothelial"  "Mesenchymal"  "Myeloid"      "Other_immune" "Tc_cells"    
## [6] "Th_cells"

##      cell_type    p.value FDR_corrected
## 1  Endothelial 0.06666667     0.4000000
## 2  Mesenchymal 0.35238095     0.5714286
## 3      Myeloid 0.47619048     0.5714286
## 4 Other_immune 0.91428571     0.9142857
## 5     Tc_cells 0.35238095     0.5714286
## 6     Th_cells 0.47619048     0.5714286

Differential protein expression

med_endo <- median_by_pt(annot_df, ref, subset_celltype=T, celltype_col='cell_type',
    celltype_name='Endothelial', ask_features=F, ft_idxs = c(15, 17:31, 33:35, 37:48, 50, 51), 
    ptID_col = 'pt_ID', groups=c('G', 'P'))

med_epi <- median_by_pt(annot_df, ref, subset_celltype=T, celltype_col='cell_type',
    celltype_name='Epithelial', ask_features=F, ft_idxs = c(15, 17:31, 33:35, 37:48, 50, 51), 
    ptID_col = 'pt_ID', groups=c('G', 'P'))
## Warning in wilcox.test.default(exp_median[ig1, i], exp_median[ig2, i]): cannot
## compute exact p-value with ties

## Warning in wilcox.test.default(exp_median[ig1, i], exp_median[ig2, i]): cannot
## compute exact p-value with ties

## Warning in wilcox.test.default(exp_median[ig1, i], exp_median[ig2, i]): cannot
## compute exact p-value with ties
med_fibmes <- median_by_pt(annot_df, ref, subset_celltype=T, celltype_col='cell_type',
    celltype_name='Mesenchymal', ask_features=F, ft_idxs = c(15, 17:31, 33:35, 37:48, 50, 51), 
    ptID_col = 'pt_ID', groups=c('G', 'P'))
## Warning in wilcox.test.default(exp_median[ig1, i], exp_median[ig2, i]): cannot
## compute exact p-value with ties

## Warning in wilcox.test.default(exp_median[ig1, i], exp_median[ig2, i]): cannot
## compute exact p-value with ties
med_imm <- median_by_pt(annot_df, ref, subset_celltype=T, celltype_col='cell_type',
    celltype_name='Immune', ask_features=F, ft_idxs = c(15, 17:31, 33:35, 37:48, 50, 51), 
    ptID_col = 'pt_ID', groups=c('G', 'P'))
## Warning in wilcox.test.default(exp_median[ig1, i], exp_median[ig2, i]): cannot
## compute exact p-value with ties

## Warning in wilcox.test.default(exp_median[ig1, i], exp_median[ig2, i]): cannot
## compute exact p-value with ties

## Warning in wilcox.test.default(exp_median[ig1, i], exp_median[ig2, i]): cannot
## compute exact p-value with ties
med_CD8T <- median_by_pt(annot_df, ref, subset_celltype=T, celltype_col='subtype',
    celltype_name='Tc_cells', ask_features=F, ft_idxs = c(15, 17:31, 33:35, 37:48, 50, 51), 
    ptID_col = 'pt_ID', groups=c('G', 'P'))

med_CD4T <- median_by_pt(annot_df, ref, subset_celltype=T, celltype_col='subtype',
    celltype_name='Th_cells', ask_features=F, ft_idxs = c(15, 17:31, 33:35, 37:48, 50, 51), 
    ptID_col = 'pt_ID', groups=c('G', 'P'))
## Warning in wilcox.test.default(exp_median[ig1, i], exp_median[ig2, i]): cannot
## compute exact p-value with ties
med_mye <- median_by_pt(annot_df, ref, subset_celltype=T, celltype_col='subtype',
    celltype_name='Myeloid', ask_features=F, ft_idxs = c(15, 17:31, 33:35, 37:48, 50, 51), 
    ptID_col = 'pt_ID', groups=c('G', 'P'))
## Warning in wilcox.test.default(exp_median[ig1, i], exp_median[ig2, i]): cannot
## compute exact p-value with ties

## Warning in wilcox.test.default(exp_median[ig1, i], exp_median[ig2, i]): cannot
## compute exact p-value with ties

## Warning in wilcox.test.default(exp_median[ig1, i], exp_median[ig2, i]): cannot
## compute exact p-value with ties

## Warning in wilcox.test.default(exp_median[ig1, i], exp_median[ig2, i]): cannot
## compute exact p-value with ties

Endothelial cells

## Using CANARY, pt_ID as id variables

##              Protein   p.value FDR_corrected
## 1      144Nd_HLA-ABC 0.1714286     0.7619048
## 2         145Nd_CD31 0.4761905     0.7619048
## 3  146Nd_Thioredoxin 0.3523810     0.7619048
## 4        147Sm_b-CAT 0.4761905     0.7619048
## 5     156Gd_Vimentin 1.0000000     1.0000000
## 6      158Gd_p-STAT3 0.7619048     0.8465608
## 7         160Gd_MDM2 0.6095238     0.7619048
## 8  161Dy_Cytokeratin 0.4761905     0.7619048
## 9         163Dy_TP63 0.6095238     0.7619048
## 10      174Yb_HLA-DR 0.1714286     0.7619048
## Warning in geom2trace.default(dots[[1L]][[10L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[10L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[10L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[10L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[10L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[10L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[10L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[10L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[10L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[10L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

Fibroblasts/Mesenchymal cells

## Using CANARY, pt_ID as id variables
## Warning in wilcox.test.default(c(0, 0.0958118253303701, 0.284162729407862, :
## cannot compute exact p-value with ties
## Warning in wilcox.test.default(c(0.802649816095183, 0.215492384630114,
## 0.0605647943338007, : cannot compute exact p-value with ties

##          Protein    p.value FDR_corrected
## 1    141Pr_EpCAM 0.76190476     0.9142857
## 2   142Nd_ccasp3 0.91428571     0.9142857
## 3     155Gd_CD56 0.47619048     0.8571429
## 4 156Gd_Vimentin 0.91428571     0.9142857
## 5  158Gd_p-STAT3 0.11428571     0.5142857
## 6     160Gd_MDM2 0.19945761     0.5983728
## 7     163Dy_TP63 0.47619048     0.8571429
## 8      170Yb_CD3 0.91406196     0.9142857
## 9   174Yb_HLA-DR 0.03809524     0.3428571
## Warning in wilcox.test.default(c(0, 0.0958118253303701, 0.284162729407862, :
## cannot compute exact p-value with ties
## Warning in wilcox.test.default(c(0.802649816095183, 0.215492384630114,
## 0.0605647943338007, : cannot compute exact p-value with ties
## Warning in geom2trace.default(dots[[1L]][[9L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[9L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[9L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[9L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[9L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[9L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[9L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[9L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[9L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

Immune cells

## Using CANARY, pt_ID as id variables
## Warning in wilcox.test.default(c(3.06708656196431, 0.066910551904235,
## 3.04431780411568, : cannot compute exact p-value with ties
## Warning in wilcox.test.default(c(0.202586121632867, 0.0645635010399363, : cannot
## compute exact p-value with ties
## Warning in wilcox.test.default(c(0.501727573634015, 0.130067040154415,
## 0.712432219756351, : cannot compute exact p-value with ties

##           Protein   p.value FDR_corrected
## 1   144Nd_HLA-ABC 0.1055017     0.8571429
## 2      154Sm_CD45 0.4761905     0.9523810
## 3  156Gd_Vimentin 0.4761905     0.9523810
## 4   158Gd_p-STAT3 0.7619048     0.9523810
## 5       159Tb_CD4 0.9140620     1.0000000
## 6      163Dy_TP63 0.6095238     0.9523810
## 7      166Er_CD44 1.0000000     1.0000000
## 8       170Yb_CD3 0.7619048     0.9523810
## 9     171Yb_CD11b 0.3314247     0.9523810
## 10   174Yb_HLA-DR 0.1714286     0.8571429
## Warning: Removed 1 rows containing non-finite values (stat_boxplot).
## Warning: Removed 1 rows containing non-finite values (stat_signif).
## Warning in wilcox.test.default(c(3.06708656196431, 0.066910551904235,
## 3.04431780411568, : cannot compute exact p-value with ties
## Warning in wilcox.test.default(c(0.202586121632867, 0.0645635010399363, : cannot
## compute exact p-value with ties
## Warning in wilcox.test.default(c(0.501727573634015, 0.130067040154415,
## 0.712432219756351, : cannot compute exact p-value with ties
## Warning in geom2trace.default(dots[[1L]][[10L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[10L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[10L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[10L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[10L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[10L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[10L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[10L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[10L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[10L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

CD8 T cells

## Using CANARY, pt_ID as id variables

##          Protein    p.value FDR_corrected
## 1  144Nd_HLA-ABC 0.03174603     0.2539683
## 2     154Sm_CD45 0.90476190     0.9047619
## 3 156Gd_Vimentin 0.55555556     0.8344671
## 4     163Dy_TP63 0.19047619     0.5079365
## 5     166Er_CD44 0.73015873     0.8344671
## 6      168Er_CD8 0.55555556     0.8344671
## 7      170Yb_CD3 0.73015873     0.8344671
## 8   174Yb_HLA-DR 0.11111111     0.4444444
## Warning in geom2trace.default(dots[[1L]][[8L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[8L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[8L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[8L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[8L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[8L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[8L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[8L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

CD4 T cells

## Using CANARY, pt_ID as id variables
## Warning in wilcox.test.default(c(0, 0.0561621657336121, 0, 0), c(0, 0,
## 1.50456532271426, : cannot compute exact p-value with ties

##          Protein   p.value FDR_corrected
## 1  144Nd_HLA-ABC 0.6095238     0.9142857
## 2     154Sm_CD45 0.3523810     0.7928571
## 3 156Gd_Vimentin 0.2571429     0.7714286
## 4      159Tb_CD4 0.6095238     0.9142857
## 5     163Dy_TP63 0.7619048     0.9795918
## 6     166Er_CD44 0.1714286     0.7714286
## 7     169Tm_CD24 1.0000000     1.0000000
## 8      170Yb_CD3 0.2571429     0.7714286
## 9   174Yb_HLA-DR 0.9142857     1.0000000
## Warning in wilcox.test.default(c(0, 0.0561621657336121, 0, 0), c(0, 0,
## 1.50456532271426, : cannot compute exact p-value with ties
## Warning in geom2trace.default(dots[[1L]][[9L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[9L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[9L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[9L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[9L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[9L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[9L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[9L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[9L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

Myeloid cells

## Using CANARY, pt_ID as id variables
## Warning in wilcox.test.default(c(3.30075534359615, 0.0972935332589382,
## 3.31354462816258, : cannot compute exact p-value with ties
## Warning in wilcox.test.default(c(1.62386202915046, 0.717296683223608,
## 2.44717234480325, : cannot compute exact p-value with ties
## Warning in wilcox.test.default(c(0.748820669157824, 0.123253874437529,
## 1.67192224879611, : cannot compute exact p-value with ties
## Warning in wilcox.test.default(c(0.63662474810693, 0.0913139040611759,
## 1.20841095112529, : cannot compute exact p-value with ties

##              Protein   p.value FDR_corrected
## 1      144Nd_HLA-ABC 0.1645218     0.9523810
## 2         145Nd_CD31 0.4541743     0.9523810
## 3  146Nd_Thioredoxin 0.5929097     0.9846154
## 4         154Sm_CD45 0.4761905     0.9523810
## 5     156Gd_Vimentin 0.4761905     0.9523810
## 6      158Gd_p-STAT3 0.3523810     0.9523810
## 7          159Tb_CD4 0.7461278     0.9846154
## 8         160Gd_MDM2 0.9142857     0.9846154
## 9         163Dy_TP63 1.0000000     1.0000000
## 10        166Er_CD44 0.9142857     0.9846154
## 11       171Yb_CD11b 0.4761905     0.9523810
## 12        172Yb_p-S6 0.9142857     0.9846154
## 13      174Yb_HLA-DR 0.2571429     0.9523810
## 14       175Lu_PD-L1 0.7619048     0.9846154
## Warning: Removed 4 rows containing non-finite values (stat_boxplot).
## Warning: Removed 4 rows containing non-finite values (stat_signif).
## Warning in wilcox.test.default(c(3.30075534359615, 0.0972935332589382,
## 3.31354462816258, : cannot compute exact p-value with ties
## Warning in wilcox.test.default(c(1.62386202915046, 0.717296683223608,
## 2.44717234480325, : cannot compute exact p-value with ties
## Warning in wilcox.test.default(c(0.748820669157824, 0.123253874437529,
## 1.67192224879611, : cannot compute exact p-value with ties
## Warning in wilcox.test.default(c(0.63662474810693, 0.0913139040611759,
## 1.20841095112529, : cannot compute exact p-value with ties
## Warning in geom2trace.default(dots[[1L]][[14L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[14L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[14L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[14L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[14L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[14L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[14L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[14L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[14L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[14L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[14L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[14L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[14L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[14L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

Epithelial cells

## Using CANARY, pt_ID as id variables
## Warning in wilcox.test.default(c(2.33079293987923, 0.0582644008491126,
## 1.75087785796523, : cannot compute exact p-value with ties
## Warning in wilcox.test.default(c(1.63156525887895, 0.322305842850225,
## 1.32203451663395, : cannot compute exact p-value with ties
## Warning in wilcox.test.default(c(1.13653172069154, 0.0527562183492093,
## 1.50292979733778, : cannot compute exact p-value with ties

##              Protein    p.value FDR_corrected
## 1        141Pr_EpCAM 0.11428571     0.4114286
## 2       142Nd_ccasp3 0.35238095     0.5714286
## 3      144Nd_HLA-ABC 0.16452182     0.4408163
## 4        147Sm_b-CAT 0.17142857     0.4408163
## 5         148Nd_HER2 0.03809524     0.4114286
## 6         151Eu_TTF1 0.09898793     0.4114286
## 7         154Sm_CD45 0.47619048     0.5714286
## 8         155Gd_CD56 0.76190476     0.8067227
## 9     156Gd_Vimentin 0.47619048     0.5714286
## 10     158Gd_p-STAT3 0.35238095     0.5714286
## 11        160Gd_MDM2 0.91428571     0.9142857
## 12 161Dy_Cytokeratin 0.11428571     0.4114286
## 13         162Dy_MET 0.25714286     0.5142857
## 14        163Dy_TP63 0.47619048     0.5714286
## 15         164Dy_CK7 0.47619048     0.5714286
## 16        165Ho_EGFR 0.10550173     0.4114286
## 17         170Yb_CD3 0.60952381     0.6857143
## 18      174Yb_HLA-DR 0.25714286     0.5142857
## Warning in wilcox.test.default(c(2.33079293987923, 0.0582644008491126,
## 1.75087785796523, : cannot compute exact p-value with ties
## Warning in wilcox.test.default(c(1.63156525887895, 0.322305842850225,
## 1.32203451663395, : cannot compute exact p-value with ties
## Warning in wilcox.test.default(c(1.13653172069154, 0.0527562183492093,
## 1.50292979733778, : cannot compute exact p-value with ties
## Warning in geom2trace.default(dots[[1L]][[18L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[18L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[18L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[18L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[18L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[18L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[18L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[18L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[18L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[18L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[18L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[18L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[18L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[18L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[18L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[18L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[18L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

## Warning in geom2trace.default(dots[[1L]][[18L]], dots[[2L]][[1L]], dots[[3L]][[1L]]): geom_GeomSignif() has yet to be implemented in plotly.
##   If you'd like to see this geom implemented,
##   Please open an issue with your example code at
##   https://github.com/ropensci/plotly/issues

Cell type proyection

# sampling k cells per sample
smpl <- annot_df[1,]
smpl <- smpl[-1,]
k = 2000
pts = unique(annot_df$pt_ID)
for(i in pts){
  #print(dim(annot_df[which(annot_df$pt_ID == i),]))
  x <- dplyr::sample_n(annot_df[which(annot_df$pt_ID %in% i),], size=k, replace=F)
  smpl <- rbind(smpl, x)
}
smpl <- denoisingCTF::t_asinh(smpl)
#print(as.matrix(colnames(annot_df)))
#col_id <- c(15, 17:31, 33:35, 37, 38, 40:51)
col_id <- c(15, 19,20, 29:31, 34,37,38, 40,41, 44, 46,47, 50)

#col_id <- c(15, 20,29:31,34,37,40,44,46,47)


# tSNE
tsne_smp <- Rtsne::Rtsne(smpl[,col_id],  check_duplicates = FALSE)
tsne_smp <- as.data.frame(cbind(smpl,
                                    tSNE1 = tsne_smp$Y[,1],
                                    tSNE2 = tsne_smp$Y[,2]))
# UMAP
umap_smp <- umap::umap(smpl[,col_id])
umap_smp <- as.data.frame(cbind(smpl,
                                    UMAP1 = umap_smp$layout[,1],
                                    UMAP2 = umap_smp$layout[,2]))
ClusterEval_plot(tsne_smp, data_type = 'tSNE', cluster_col= 'subtype4', ft_cols = col_id)
## 
## Attaching package: 'gridExtra'
## The following object is masked from 'package:dplyr':
## 
##     combine

ClusterEval_plot(umap_smp, data_type = 'UMAP', cluster_col= 'subtype4', ft_cols = col_id)